<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta content="telephone=no" name="format-detection" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>泸州市娱乐业信息管理系统</title>
<link type="text/css" rel="stylesheet" href="../resource/fapiao.css">
<link rel="stylesheet" href="../resource/weuimin.css" />
<link rel="stylesheet" href="../resource/example.css" />
<script type="text/javascript" src="../resource/jweixin1002.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../resource/jweixin1.js"></script>
<script src="../resource/jquery1.js"></script>
<script src="../resource/qrcode.js"></script>
<script src="../resource/jquerybarcode.js"></script>
<script src="../template/js/jquery.js"></script>
<script src="../resource/my.js"></script>
<script src="../script/api.js"></script>

<link rel="stylesheet" href="../resource/jinsuistyle.css" />
<style>
.nav{
	padding: 10px 2%;
}
.bg {
    padding: 15px 0 15px;
}
.weui-grid{width:50%;}
.weui-grid__icon{width: 50px;height: 50px;}
.isnew{background: #FFFFFF url('template/images/xp4.png') no-repeat 100% 0px ;}
#msg{display:inline-block;width:20px;line-height:20px;height:20px;background-color:red;border-radius:10px;border:1px solid #333333;color:#FFFFFF;font-weight:bold;

     height: 100%;
                background-color: #f0f0f0;
            }
            
            input {
                height: 50px;
                width: 80%;
                font-size: 20px;
                color: #8E8C8C;
            }
            
            input::-webkit-input-placeholder {
                color: #ccc;
            }
            
           .loginbg {
                width: 100%;
            }
            
            
            .divider {
                height: 0px  
            }
  
   /*         登录条与上面图片的高度（间距）*/
            .user,
            .passwd {

                background: #1fff;

            }
            
            .passwd img,
            .user img {
                vertical-align: top;
            }
            
            .item {
                background-color: #fff;
                border-bottom: 2px solid #e0e0e0;
                position: relative;
                height: 40px;
                font-size: 20px;
            }
            
            .btn {
                margin: 3px 10px;
                background: #18b4ed;
                height: 80px;
                line-height: 80px;
                text-align: center;
                font-size: 20px;
                margin-top: 20px;
                border-radius: 5px;
                color: #fff;
            }
            
            .user img {
                width: 25px;
                margin-top: 5px;
                margin-left: 50px;
                margin-right: 10px;
            }
            
            .passwd img {   /* 密码中图片框*/
                height: 25px;      /*  高度*/
                margin-top: 5px;   /* 上边距*/
                margin-left: 50px;   /*左边距*/
                margin-right: 10px;  /*右边距*/
            }
            
            .bottom {
                position: absolute;
                left: 0px;
                bottom: 0px;
                width: 100%;
                text-align: center;
                font-size: 12px;
            }
            
            .bottom img {
                height: 50px;
            }
            
            .bottom .arrow {
                text-align: center;
                margin: 10px 0;
            }
            
            .bottom .arrow img {
                width: 40px;
                height: 20px;
            }
            
            #qqpic {
                margin-right: 10px;
                margin-left: 10px;
            }
            
            .thirdinfo {
                color: #666;
                margin-top: 10px;
            }
            
            .thirdcompy .left {
                margin-right: 20px;
            }
            
            .thirdcompy .left,
            .thirdcompy .right {
                width: 40%;
                display: inline-block;
                background: #fff;
                border: 1px solid #e0e0e0;
                border-radius: 4px;
                vertical-align: top;
                text-align: left;
                font-size: 18px;
            }
            
            .thirdcompy .left img,
            .thirdcompy .right img {
                width: 30px;
                height: 30px;
                float: left;
                margin: 5px 10px;
            }
            
            .thirdcompy span {
                line-height: 40px;
                color: #666;
            }
            
            .loginmore {
                margin-top: 10px;
            }
            
            .loginmore span {
                color: #0078ff;
            }
            
            .loginmore .forget {
                margin-left: 10px;
            }
            
            .loginmore .phone {
                margin-right: 10px;
                float: right;
            }
            
            .btnhover {
                background-color: #dcdcdc !important;
            }
            
            .buyhover {
                background-color: rgba(252, 85, 0, 0.6) !important;
            }
            
            .presshover {
                background-color: #FAFAFA !important;
            }
            
            .txthover {
                color: rgba(0, 120, 255, 0.6) !important;
            }
            
            input {
                outline: none;
            }


   .userinfo {
                position: absolute;        /*位置：绝对位置*/
                top: 60px;                
                margin-left: 100px;
            }
            
  .userdwclass {               /* 用户单位样式*/
                font-size: 14px;
                color: #fff;
            }
            .usernameclass {             /* 用户名样式*/
                font-size: 14px;
                color: #fff;
              /*  border: 1px solid #fff;  边框样式*/
                display: inline-block;   /*一行一行排，空格也显示？*/
                padding: 3px;      /*内边距*/
               /* border-radius: 4px;     圆角边框 */
                margin-top: 5px;  /*上外边距*/
            }
            .loginbg {
                width: 100%;
            }
.personal_logo {
    position: absolute;
    top: 60px;
    width: 64px;
    height: 64px;
    left: 20px;
}
.login {
                background-image: url(../image/personalbkg.jpg);
                background-repeat: no-repeat;
                background-size: contain;
                position: relative;
            }
              
    


  
 
</style>


<body>

   	 




<header id="statusBar">
	<div id="jsheader_absolute">
			<nav id="jsnav">
					<a id="jsleft" tapmode="">
							<!-- <span>返回</span> -->
					</a>
					<div id="jsmiddle">
							<strong onclick="javascript :history.back(-1);"  id="jstitle">泸州市娱乐业信息管理系统</strong>
					</div>
					<a id="jsright">
						<!-- <span></span> -->
					</a>
			</nav>
	</div>
</header>



   <div class="login open-win" win="person_info" login="true">
            <!-- <img src="../image/personal_bkg.jpg" class="loginbg">-->
        <img src="../image/personalbkg.jpg" class="loginbg">
          <img id="userAvatar" src="../image/profiledefaultq.png" class="personal_logo">
          <div class="userinfo">
                <div id="userdw" class="userdwclass">登录场所：</div>
                <div id="username" class="usernameclass">登录用户：</div>
            </div>
        </div>
        


        <section>
            <div class="btn" tapmode onclick=" scanner0()">上班打卡</div>
        </section>

        <section>
            <div class="btn" tapmode onclick=" scanner1()">下班打卡</div>
        </section>


  <script type="text/javascript">
  
  
 apiready = function () {
 if(api.systemType == "ios"){
   document.getElementById("statusBar").style.background = "#298cb4";
}
 $api.fixStatusBar( $api.dom('header') );
 userdw = $api.byId('userdw');           
 userdw.innerHTML = '登录场所：' + $api.getStorage('dw_name') ;    //设置登录名
 username = $api.byId('username');           
 username.innerHTML = '登录用户：' + $api.getStorage('name') ;    //设置登录名
      }
      
      
/*

       document.getElementById("dw_name").value = $api.getStorage('dw_name');   //自动执行，将登录 人员所属单位名称填入
       document.getElementById("qyid").value = $api.getStorage('dwid');         //自动执行，将登录 人员所属单位ID填入企业ID 
       document.getElementById("name").value = $api.getStorage('name');         //自动执行，将登录 人员姓名  
       document.getElementById("dw_code").value = $api.getStorage('dw_code');   //自动执行，将登录 人员所属单位代码填入
       document.getElementById("dw_sf").value = $api.getStorage('dw_sf');       //自动执行，将登录 人员所属单位身份填入

*/

    		          

function scanner0(){
				var FNScanner = api.require('FNScanner');
				 FNScanner.openScanner({
		   		 autorotation: true,
					}, function(ret, err) {
		    	if (ret) {
					  var getinfo=ret.content;

						if(getinfo!=null){
							var dktime=getinfo.substring(14);  			//截取前14个字符，只保留后面的打卡时间		“q151050000001,2017-09-21 09:00:28”
							api.confirm({
								    title: '你确定【上班】签到吗？',
								    msg: dktime,
								    buttons: ['确定', '取消']
								}, function(ret, err) {
									if(ret.buttonIndex==1){     //如果返回为1（确定） 2是取消  （从左到右的顺序）
									   sbdk(getinfo,'0');       //调用sbdk()
									    }
								});	
						  }						
				    } else {    //如果是取值失败
						       alert(JSON.stringify(err));
						    	}
						     });
			           	}



							

	function scanner1(){
			var FNScanner = api.require('FNScanner');
			    FNScanner.openScanner({
				autorotation: true,
					}, function(ret, err) {
		    	if (ret) {
					  var getinfo=ret.content;

						if(getinfo!=null){
							var dktime=getinfo.substring(14);  		//截取前14个字符，只保留后面的打卡时间	“q151050000001,2017-09-21 09:00:28”			
							api.confirm({
								    title: '你确定【下班】签到吗？',
								    msg: dktime,
								    buttons: ['确定', '取消']
								}, function(ret, err) {
									if(ret.buttonIndex==1){     //如果返回为1（确定）  2是取消  （从左到右的顺序）
									   sbdk(getinfo,'1');      //调用sbdk()
									    }
								});	
						  }						
				    } else {    //如果是取值失败
						       alert(JSON.stringify(err));
						    	}
						     });
			           	}




	function sbdk(info,dkbz){

	/*
	      jQuery.ajax({
		        url: Serverip + '/base/syuser!doNotNeedSessionAndSecurity_SavedkInfo.sy',
		        type:'post',
		        data: {
		        info:info,    //返回企业编码和日期时间 数据
		        dkbz:dkbz,    //传上下班标志  0是上班/1是下班
		        qyid:$api.getStorage('dwid'),    //传登录单位的ID
		        ryid:$api.getStorage('id')       //传登录人员的ID
		        },
		        dataType:'json',
		        error:function(xhr, textStatus, errorThrown){
		          console.log(xhr + "服务请求错误,请联系管理员【错误代码："+xhr.status+"】" + errorThrown);
		        },
		        success:function(data){
		        
		         switch(data.returninfo){

	              case 0:
			              alert("打卡登记成功！");
		                  location.href='ccyrydk.html';
	 	                  break;
	 	          case 1:
		                 alert("打卡登记失败!\n请与场所系统管理员联系！");
		                 break;
	              case 2:
		                 alert("打卡登记失败!\n登录从业人员与二维码的不是同一场所！");
		                 break;

                      }

			    }
			});
			
		*/	
			
		api.ajax({ 
		            url: Serverip + '/base/syuser!doNotNeedSessionAndSecurity_SavedkInfo.sy',
		            method: 'post',
					dataType: 'json',
		            data: { 
					            values:{
								    info:info,    //返回企业编码和日期时间 数据
							        dkbz:dkbz,    //传上下班标志  0是上班/1是下班
							        qyid:$api.getStorage('dwid'),    //传登录单位的ID
							        ryid:$api.getStorage('id')       //传登录人员的ID						    							    
								       }, 
                          },
		            timeout: 30,
                  }, function(ret, err) { 
				    if (ret) {
				        		 switch(ret.returninfo){ 
						              case 0:
								              alert("打卡登记成功！");
							                  location.href='ccyrydk.html';
						 	                  break;
						 	          case 1:
							                 alert("打卡登记失败!\n请与场所系统管理员联系！");
							                 break;
						              case 2:
							                 alert("打卡登记失败!\n登录从业人员与二维码的不是同一场所！");
							                 break;
					
					                      }
				        
				       }else {
                            api.alert({msg:('错误码：'+err.code+'；错误信息：'+err.msg+'网络状态码：'+err.statusCode)}); 
				           };

                 });	
           }

    </script>

		
	<div class="page__ft">
	            <p><a style="color:#777;font-size:12px" onclick="alert(api.deviceId)">泸州市公安局</a></p>
				<p><a style="color:#777;font-size:12px" onclick="alert(api.deviceId)">四川航天金穗高技术有限公司</a><b id="bbb"></b></p>
	</div>

</body>
</html>
